package weather_service.weatherprovider.weatherdatamodel;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * Errors returned by the service, usually due to a bad zipcode.
 * <p/>
 */
public class Error {

  public static final String UNKNOWN_ERROR = "An unknown error has occurred";
  public static final String NO_LOCATION_PROVIDED = "No location provided";
  public static final String INVALID_LOCATION = "Invalid location provided";
  public static final String INVALID_PARTNER_ID = "Invalid partner ID";
  public static final String INVALID_PRODUCT_CODE = "Invalid product code";
  public static final String INVALID_LICENSE_KEY = "Invalid license key";

  private int errorCode;
  private String errorMessage;

  public Error(int errorCode, String errorMessage) {
    this.errorCode = errorCode;
    this.errorMessage = errorMessage;
  }

  public int getErrorCode() {
    return errorCode;
  }

  public String getErrorMessage() {
    return errorMessage;
  }

  public String toString() {
    return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
  }

}

